#include <random>
#include <iostream>

using namespace std;

unsigned int rand_int(int seed = -1, int a = 1, int b = 0)
{
    static uniform_int_distribution<unsigned int> uid(0, 9999); // static 被调用方管理
    static default_random_engine e;                             // 同上

    if (seed >= 0)
        e.seed(seed);
    if (a <= b)
        uid = uniform_int_distribution<unsigned int>(a, b); // 调用方指定
    return uid(e);
}

int main()
{
    int n = 10;
    // 改seed 然后print一些
    rand_int(42);
    for (int i = 0; i < n; i++)
    {
        cout << rand_int() << " ";
    }
    cout << endl;

    rand_int(88);
    for (int i = 0; i < n; i++)
    {
        cout << rand_int() << " ";
    }
    cout << endl;

    rand_int(11, 0, 10);
    for (int i = 0; i < n; i++)
    {
        cout << rand_int() << " ";
    }
    cout << endl;
}